package com.newasia.server.common.loginStrategy;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Tom.
 */
public class LoginStrategy {
    public static  final String PASSWORD_LOGIN = "PasswordLogin";
    public static  final String WECHAT_LOGIN = "WechatLogin";
    public static  final String DEFAULT_PAY = PASSWORD_LOGIN;

    private static Map<String,LoginMethod> strategy = new HashMap<String,LoginMethod>();

    static {
        strategy.put(PASSWORD_LOGIN,new PasswordLoginMethod());
        strategy.put(WECHAT_LOGIN,new WeChatLoginMethod());
    }

    public static LoginMethod get(String payKey){
        if(!strategy.containsKey(payKey)){
            return strategy.get(DEFAULT_PAY);
        }
        return strategy.get(payKey);
    }
}
